﻿using Abp.Application.Services;
using Abp.Domain.Entities;
using Abp.Domain.Repositories;
using Abp.Web.Models;
using System;

namespace Batman.Cms.Core.Services
{
    public class BaseManager<T> : ApplicationService where T : Entity<string>
    {
        public IRepository<T, string> Repository { get; set; }

        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public AjaxResponse Excute(Func<IRepository<T, string>, AjaxResponse> func = null)
        {
            if (func != null)
            {
                return func.Invoke(Repository);
            }

            return new AjaxResponse { Success = true };
        }
    }
}
